package com.yohann.designPattern.command;

/**
 * <p>
 * 客户端
 * </p>
 *
 * @author Yohann
 * @since 2021/2/11 16:34
 */
public class Client {
    public static void main(String[] args) {
        LightReceiver receiver = new LightReceiver();
        LightOnCommand onCommand = new LightOnCommand(receiver);
        LightOffCommand offCommand = new LightOffCommand(receiver);
        RemoteController controller = new RemoteController();

        controller.setCommand(0, onCommand, offCommand);

        //light on
        controller.onButtonPushed(0);

        //light off
        controller.offButtonPushed(0);

        //light on
        controller.undoButtonPushed(0);
    }
}